Deleting object by DXL is not saved

Hello,

I am writing a script which should:

1. delete all links in doors module

2. delete all objects with attribute "Object Number" = 3

3. save and close the module.

1st and 2nd steps works fine when I do not save module by script. All links and wanted objects are deleted.

The problem occurs, when I was trying to save and close module by DXL script. The module is closing, but when I open it manually to check if changes are saved, then I can see, that links are deleted, but objects are still there.

It is really weird, because saving it manually works and all changes (deleting links and objects) works fine but with saving it by DXL only deleting links is saved.

 

There are important parts of script:

 

open module, call functions, save and close module:

Module m = edit(fullName(itm), true)
dalDeleteAllLinks(m)
clear_module(m)
save m
close m

 

clear_module function:

void clear_module(Module m)
{
        Object current_object = first(m)
        Object o = null
        
        string s = null
        string oot = null
        string oot2 = null

        bool delflag = false
        bool delflagfuture = false

        for o in m do
        {
                oot2=null
                
                oot2 = probeAttr_(o, "Object Number")

                if(oot2=="3")
                        delflagfuture=true
                
                if(oot2=="4")
                {
                        delflag=false
                        delflagfuture = false
                }
                
                if(delflag==true)
                        delete(o)
                        
                if(delflagfuture==true)
                        delflag=true
        }
        
        test_case_flag = 0
        while (test_case_flag == 0)
        {
                string s1 = current_object."Object Heading"
                string s2 = "Test Cases"
                
                if (cistrcmp(s1, s2) == 0)
                {
                test_case_flag = 1
                break
                }
                else
                {
                current_object = next sibling current_object
                }
        }
}

If I am not clear with my description or more code is needed for help, I will provide it.


GohanP - Fri Apr 14 05:29:54 EDT 2017

Re: Deleting object by DXL is not saved
Mathias Mamsch - Fri Apr 14 06:07:20 EDT 2017

do a flushDeletions() before you save the module. Regards, Mathias